package com.example.carconsumer.controller.hkf;


import com.alibaba.dubbo.config.annotation.Reference;
import com.example.carinterface.pojo.User;
import com.example.carinterface.service.hkf.CarService;
import com.example.carinterface.service.hkf.UserService;
import com.example.carinterface.utils.ResultJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@CrossOrigin
@Api(value = "用户端遍历汽车接口", tags = "用户端遍历汽车接口")
@RestController
@RequestMapping("/user")
public class CarController {
    @Reference(check = false)
    CarService carService;

    @GetMapping("/selectBrand")
    @ApiOperation(value = "遍历汽车品牌信息", responseReference = "遍历汽车品牌信息", httpMethod = "get", response = ResultJson.class)
    public ResultJson selectBrand(){
        return   carService.selectBrand();
    }

    @PostMapping("/selectcarModel")
    @ApiOperation(value = "遍历汽车型号信息", responseReference = "遍历汽车型号信息", httpMethod = "post", response = ResultJson.class)
    public ResultJson selectcarModel(@RequestBody @ApiParam(name = "brandId", value = "汽车品牌id（brandId）", required = true)Map map){


        return   carService.selectcarModel(map);
    }

    @PostMapping("/selectCarPartsPrice")
    @ApiOperation(value = "估损接口", responseReference = "估损接口", httpMethod = "post", response = ResultJson.class)
    public ResultJson selectCarPartsPrice(@ApiParam(name = "集合", value = "车辆型号id（carModelId），集合（list）{配件id（carPartsId）,损坏程度(damagedState /1轻微，2严重，3非常严重)}", required = true) @RequestBody Map<String,Object> map)
    {
        return  carService.selectCarPartsPrice(map);

    }

    @GetMapping("/selectCarParts")
    @ApiOperation(value = "遍历汽车配件信息", responseReference = "遍历汽车配件信息", httpMethod = "get", response = ResultJson.class)
    public ResultJson selectCarParts(@ApiParam(name = "carModelId", value = "汽车型号id（carModelId）", required = true)Integer carModelId){
        return   carService.selectCarParts(carModelId);
    }
}
